<?php

include_once("controller/HumanController.php");

$controller = new HumanController();

if(isset($_GET['method'])){
	$method = strtolower($_GET['method']);

	switch ($method){
		case 'gettourguiderlist':
			$controller->getTourguiderList();
			break;
		case 'gettourguiderbyid':
			$tourguiderId = intval($_GET['id']);
			$controller->getTourguiderById($tourguiderId);
			break;
		case 'login':
			// Define $myusername and $mypassword
			$username=strval($_GET['username']);
			$password=strval($_GET['password']);
			$controller->login($username, $password);
			break;
		case 'uploadinfo':
	
			$name= isset($_REQUEST['name']) ? $_REQUEST['name'] : '';//$_GET['name'];
			$username=isset($_REQUEST['username']) ? $_REQUEST['username'] : '';//$_GET['username'];
			$password=isset($_REQUEST['password']) ? $_REQUEST['password'] : '';//$_GET['password'];
			$age=isset($_REQUEST['age']) ? $_REQUEST['age'] : '';//$_GET['age'];
			$phone=isset($_REQUEST['phone']) ? $_REQUEST['phone'] : '';//$_GET['phone'];
			$imagelink=isset($_REQUEST['imagelink']) ? $_REQUEST['imagelink'] : '';//$_GET['imagelink'];
			$latitude=isset($_REQUEST['latitude']) ? $_REQUEST['latitude'] : '';//$_GET['latitude'];
			$longitude=isset($_REQUEST['longitude']) ? $_REQUEST['longitude'] : '';//$_GET['longitude'];
			$tourcode=isset($_REQUEST['tourcode']) ? $_REQUEST['tourcode'] : '';//$_GET['tourcode'];
			$uuid=isset($_REQUEST['uuid']) ? $_REQUEST['uuid'] : '';//$_GET['uuid'];
			$type=isset($_REQUEST['type']) ? $_REQUEST['type'] : '';//$_GET['type'];
			$controller->inserthuman($name,$username, $password,$age,$phone,$imagelink,$latitude,$longitude,$tourcode,$uuid,$type);
			break;
		case 'uploadImage':
			$controller->uploadImage();
			break;
		default:

			break;
	}
}
else{
	echo "Please set method for tourguider";
}
?>